﻿/// Write a program that reads a string from the console and lists all different words in the string
/// along with information how many times each word is found.


using System;
using System.Collections.Generic;


class zad22
{
    static void Main()
    {
        string strIn = "Write a program that reads a string from the console and prints all different letters, in the string along with information how many times each letter is found.";

        string[] str = strIn.Split(new char[] { ' ', '.', ',' }, StringSplitOptions.RemoveEmptyEntries);
        Dictionary<string, int> Letters = new Dictionary<string, int>();

        foreach (var item in str)
        {
            string check = item.ToLower();

            if (Letters.ContainsKey(check))
            {
                Letters[check]++;
            }
            else
            {
                Letters.Add(check, 1);
            }
        }

        foreach (var letter in Letters)
        {
            Console.WriteLine("{0, -15} - {1,3}", letter.Key, letter.Value);
        }

        Console.WriteLine();
    }

}

